package com.jlastu.znb.view;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.jlastu.znb.R;

public class SellGoodsFragment extends Fragment {
    private MainActivity mainActivity;
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof MainActivity) {
            mainActivity = (MainActivity) context;
        }
    }
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        // 使用SellGoodsActivity的布局作为这个Fragment的布局
        View view = inflater.inflate(R.layout.sell, container, false);
        Button buyGoodsButton = view.findViewById(R.id.mai111);
        buyGoodsButton.setOnClickListener(v -> {
            // 调用MainActivity的方法来更改文本
            if (mainActivity != null) {
                mainActivity.changeSchoolButtonTextToOriginal();

            }
        });
        return view;
    }
}